import { request } from '@utils/http'
import {
  IhospitalListRes,
  IdictArr,
  Iparams,
  IhospitalShow,
  IdepList,
  IscheduleList,
  IhospitalScheduleRes,
  IscheduleTableList,
} from './model/hospitalListTypes'
// 获取医院列表数据
export function reqGetHospitalList(
  page: number,
  limit: number,
  params?: Iparams
) {
  return request.get<any, IhospitalListRes>(
    `/admin/hosp/hospital/${page}/${limit}`,
    {
      params,
    }
  )
}

// 获取省级数据
export function reqGetProvince(dictCode: string = 'province') {
  return request.get<any, IdictArr>(
    `/admin/cmn/dict/findByDictCode/${dictCode}`
  )
}
// 获取市或区级数据
export function reqGetCityOrDistrict(parentId: string) {
  return request.get<any, IdictArr>(
    `/admin/cmn/dict/findByParentId/${parentId}`
  )
}

// 获取医院详情数据函数
export function reqGetHospitalShow(id: string) {
  return request.get<any, IhospitalShow>(`/admin/hosp/hospital/show/${id}`)
}

// 获取指定医院所有科室的数据
export function reqGetDepList(hoscode: string) {
  return request.get<any, IdepList>(`/admin/hosp/department/${hoscode}`)
}
// 获取指定科室的排班规则
export function reqGetScheduleRule(
  page: number,
  limit: number,
  hoscode: string,
  depcode: string
) {
  return request.get<any, IhospitalScheduleRes>(
    `/admin/hosp/schedule/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`
  )
}

// 获取排班表格数据
export function reqGetScheduleTable(
  hoscode: string,
  depcode: string,
  workDate: string
) {
  return request.get<any, IscheduleTableList>(
    `/admin/hosp/schedule/findScheduleList/${hoscode}/${depcode}/${workDate}`
  )
}
